const indexModel = {
  namespace: 'index',
  state: {
    account: localStorage.getItem('account') || null,
    userInfo: {}, //用户信息
    spriteArry: {}, //精灵信息
    goods: [], //物品
  },
  effects: {},
  reducers: {
    //数据存储
    saveAccount(state, { payload }) {
      // localStorage.setItem('account', JSON.stringify(payload));
      return {
        ...state,
        account: payload,
      };
    },
    saveUserInfo(state, { payload }) {
      return {
        ...state,
        userInfo: payload,
      };
    },
    saveSpriteArry(state, { payload }) {
      // localStorage.setItem('spriteArry', JSON.stringify(payload));
      return {
        ...state,
        spriteArry: payload,
      };
    },
    saveGoods(state, { payload }) {
      // localStorage.setItem('goods', JSON.stringify(payload));
      return {
        ...state,
        goods: payload,
      };
    },
  },
};
export default indexModel;
